﻿
#ifndef  MY_LOGIC_H
#define MY_LOGIC_H

#include "ILogic.h"

class CLogic :  	public ILogic
{
public:
	CLogic();
	~CLogic();

	static	CLogic* getInstance();
	static void destoryInstance();

private:
	static	CLogic* create();

public:
	virtual bool init();

public:		// 回调函数

	// 连接结果的回调
	virtual void OnConnect(int iClientId, bool bConnect, int iReconnectCount, std::string  strErr);

	// 断线重连的回调
	virtual void OnReconnectAfterOffline(int iClientId, bool bConnect, int iReconnectCount, std::string  strErr);

	// 断线的回调
	virtual void OnClose(int iClientId);

	// 处理逻辑消息
	virtual int OnLogicMsg(int	iClientId, int iMainCode, int iSubCode, const char* pBody = nullptr, int iBodyLen = 0);

private:
	static CLogic*  _pLauncher;

};

#endif